package ru.stepuk.modern.distributions;

import ru.stepuk.modern.generators.RandomNumberGenerator;

/**
 *
 * @author ivan
 */
public class UniformDistribution implements Distribution {

    private double min;
    private double max;
    private RandomNumberGenerator g;

    public UniformDistribution(RandomNumberGenerator g, double min, double max) {
        this.min = min;
        this.max = max;
        this.g = g;
    }

    public double nextValue() {
        return min + g.nextValue() * (max - min);
    }

    public double getMax() {
        return max;
    }

    public double getMin() {
        return min;
    }

    @Override
    public String toString() {
        return "uniform";
    }
}
